import { Controller, Get, Post, Body, Patch, Param, Delete,UploadedFiles} from '@nestjs/common';
import { ApConfigService } from './ap_config.service';
import { UseInterceptors, UploadedFile } from '@nestjs/common';
import { AnyFilesInterceptor, FileInterceptor } from '@nestjs/platform-express';
import { storage } from './uploadStorage';
@Controller('ap/config')
export class ApConfigController {
  constructor(private readonly apConfigService: ApConfigService) {}

  //ap配置导出
  @Post('/ap_export')
  exportApConfig(){
    return this.apConfigService.exportApConfig();
  }

  // cp配置导出
  @Post('/cp_export')
  exportCpConfig(){
    return this.apConfigService.exportCpConfig();
  }

  // 保存配置
  @Post('/save')
  saveConfig(@Body()body:any){
    return this.apConfigService.saveConfig(body);
  }


   @Post('import')
   @UseInterceptors(AnyFilesInterceptor({ storage }))
   uploadAnyFiles(@UploadedFiles() files: Array<Express.Multer.File>, @Body() body){
     return {
      code:200,
      data:{
        status:true
      }
     }
   }
}
